package org.legzo.castorranker.web;

import org.apache.wicket.Application;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy;
import org.legzo.castorranker.RankerService;
import org.slf4j.Logger;

public class RankerApplication extends WebApplication {

	private final static Logger logger = org.slf4j.LoggerFactory.getLogger(RankerApplication.class);

	private RankerService rankerService;

	@Override
	protected void init() {
		logger.info("Ranker webapp init");
		super.init();

		BookmarkablePageRequestTargetUrlCodingStrategy adminURL = new BookmarkablePageRequestTargetUrlCodingStrategy(
				"admin/", AdminPage.class, null);

		mount(adminURL);
	}

	@Override
	public Class<? extends Page> getHomePage() {
		return HomePage.class;
	}

	public static RankerApplication get() {
		return (RankerApplication) Application.get();
	}

	public void setRankerService(RankerService rankerService) {
		this.rankerService = rankerService;
	}

	public RankerService getRankerService() {
		return rankerService;
	}
}
